﻿Imports System
Imports System.Data
Imports MySql.Data.MySqlClient
Public Class report_keseluruhan

    Private Sub report_keseluruhan_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'DS_t01_tugas.tugas' table. You can move, or remove it, as needed.
        Dim myConnString As String
        myConnString = "server=localhost;User Id=root;password=;Persist Security Info=True;database=db_petruk_new"
        Dim ds As New DataSet
        Dim dsconn As New MySqlConnection(myConnString)
        Dim dsDa As New MySqlDataAdapter
        Dim strsql As String = "SELECT tugas.TGL_AWAL,tugas.TGL_AKHIR,master_sopir.NAMA,master_truk.PLAT_NOMOR,master_titik.NAMA_TPS FROM tugas JOIN master_sopir ON master_sopir.ID_SOPIR=tugas.ID_SOPIR JOIN tugas_tps ON tugas_tps.ID_TUGAS=tugas.ID_TUGAS JOIN master_titik ON master_titik.ID_TITIK=tugas_tps.ID_TITIK JOIN master_truk ON master_truk.ID_TRUK = master_sopir.ID_TRUK WHERE TGL_AWAL >= '2014-02-01' AND TGL_AKHIR <= '2014-02-28'"
        Try
            dsconn.Open()
            dsDa.SelectCommand = New MySqlCommand(strsql, dsconn)
            dsDa.Fill(ds)
            ds.WriteXml(CurDir() & "/rekap_penjadwalan.xml", XmlWriteMode.WriteSchema)
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End Try
    End Sub
End Class